package game;
import java.awt.Image;
import java.awt.image.BufferedImage;

import com.golden.gamedev.object.Sprite;


public class BonusPause extends AbstractBonus
{
	private static final long serialVersionUID = 1L;
	private double time_paused = 0;
    public BonusPause (ProgBob progBob, String name, Sprite icon)
    {
        super(progBob, name, icon);
    }
    
    public BonusPause(){
    	time_paused = 0;
    	new BonusPause(super.progBob, "Pause", new Sprite(createBufferedImage("resources/bonus_pause.png")));
    }

    @Override
    protected void toggleBonus()
    {
        if (time_paused > 0){
            time_paused = 5;
        }
        else{
            time_paused = 6;
        }
    }

    @Override
    public boolean isOn() {
	return bonusBoolean;
}
    
    //This method updates the time_passed to average the elaspedTime and original time
    public void updatetime_passed(int elapsedTime){
    	time_paused = Math.max(0, time_paused - elapsedTime);
    }
    
    /*
     * This method returns the time_passed value
     */
    public double gettime_paused(){
    	return time_paused;
    }

	@Override
	public void turnOff() {
		bonusBoolean = false;
	}

	@Override
	public void turnOn() {
		bonusBoolean = true;
	}
	
	@Override
    protected void setBonusPosition(int mouseX, int mouseY, int offset){}
}

